﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <script src="js/DataProvider.js" type="text/javascript"></script>
    <title>Search Test</title>
    <script type="text/javascript">
        function Search()
        {
            var q = document.getElementById("txtSearch").value;
            
            var myData = new DataProvider();
            var res = myData.requestPage("JSONSearch.aspx?q=" + q);
            var div = document.getElementById("myDiv");
            div.innerHTML = res;
            
        }
        function MaybeSearch()
        {
            if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) 
            {
                Search();
                return false;
            }
            else return true; 
         }
    </script>
</head>
<body  onload="javascript:document.getElementById('txtSearch').focus();">

    <p>
        <input id="txtSearch" type="text" onkeydown="MaybeSearch()"  />
        <input id="btnSearch" type="button"   onclick="javascript:Search()" 
            value="Search" /></p>
    <div id="myDiv">
    </div>

</body>
</html>
